<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ page import ="java.sql.DriverManager" %>
<%@ page import ="java.sql.Connection" %>
<%@ page import ="java.sql.Statement" %>
<%@ page import ="java.sql.SQLException" %>
<%
request.setCharacterEncoding("utf-8");

String memberID = request.getParameter("memberID");
String name = request.getParameter("name");

int updateCount = 0;

Class.forName("com.mysql.jdbc.Driver");

Connection conn = null;
Statement stmt = null;

try{
	String jdbcDriver ="jdbc:mysql://192.168.0.200:3306/intra?useUnicode=true&characterEncoding=utf-8";
	String dbUser = "root";
	String dbPass = "ice1234";
	
	String query = "UPDATE MEMBER SET NAME='"+ name +"' WHERE MEMBERID='"+memberID+"'";
	conn = DriverManager.getConnection(jdbcDriver,dbUser,dbPass);
	stmt = conn.createStatement();
	updateCount = stmt.executeUpdate(query);
}finally{
	if(stmt != null) try{stmt.close();}catch(SQLException ex){}
	if(conn != null) try{conn.close();}catch(SQLException ex){}
}
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=EUC-KR">
<title>이름변경 폼</title>
</head>
<body>
	<%
	if(updateCount > 0){
		out.println(memberID+"의 이름을 "+name+"(의)로 변경");
	}else{
		out.println(memberID+" 아이디가 존재하지 않음");
	}
	%>
</body>
</html>